// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WebInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the WebInfo type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Web.UI.WebControls.WebParts;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(
        Title = "Web Part Information",
        ReleaseStatus = ReleaseStatus.Development,
        Summary = "Defines a set of parameters for a SharePoint web part." 
        )
    ]
    public class WebPartConnectionInfo : WSSEntityBase
    {
        private string webPartPageRelativeUrl;

        private PersonalizationScope personalizationScope;

        private string providerId;

        private string consumerId;

        private string providerWebPartId;

        private string consumerWebPartId;

        private WebPartTransformer webPartTransformer;

        [CollaborisProperty(
           Summary = "The relative path to the web part page containing the web parts to connect.",
           Title = "Page Name",
           Example = @"pages/Default.aspx", 
           InputHint = InputHint.SingleText,
           Required = true)]
        public string WebPartPageRelativeUrl
        {
            get
            {
                return this.webPartPageRelativeUrl;
            }
            set
            {
                this.webPartPageRelativeUrl = value;
            }
        }

        [CollaborisProperty(
             Summary = "Indicates the PersonalizationScope for a WebPartManager " + 
                        "object or the PersonalizationScope that applies to a " + 
                        "property on a web parts control.",
             Title = "Personalization Scope",
             Example = @"Shared",
             InputHint = InputHint.Enum,
             Required = true)]
        public PersonalizationScope PersonalizationScope
        {
            get
            {
                return this.personalizationScope;
            }
            set
            {
                this.personalizationScope = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies the ID of the provider connection.",
             Title = "Provider Connection Id",
             Example = @"ITransformableFilterValues",
             InputHint = InputHint.SingleText,
             Required = true)]
        public string ProviderConnectionId
        {
            get
            {
                return providerId;
            }
            set
            {
                providerId = value;
            }
        }

        [CollaborisProperty(
           Summary = "Specifies the ID of the consumer connection.",
           Title = "Consumer Connection Id",
           Example = @"ListViewFilterConsumer_WPQ_",
           InputHint = InputHint.SingleText,
           Required = true)]
        public string ConsumerConnectionId
        {
            get
            {
                return consumerId;
            }
            set
            {
                consumerId = value;
            }
        }

        [CollaborisProperty(
           Summary = "Specifies the ID of the providing web part.",
           Title = "Provider WebPart Id",
           Example = @"ProviderWebPart1",
           InputHint = InputHint.SingleText,
           Required = true)]
        public string ProviderWebPartId
        {
            get
            {
                return providerWebPartId;
            }
            set
            {
                providerWebPartId = value;
            }
        }

        [CollaborisProperty(
         Summary = "Specifies the ID of the consuming web part.",
         Title = "Consumer WebPart Id",
         Example = @"ConsumerWebPart1",
         InputHint = InputHint.SingleText,
         Required = true)]
        public string ConsumerWebPartId
        {
            get
            {
                return consumerWebPartId;
            }
            set
            {
                consumerWebPartId = value;
            }
        }

        [CollaborisProperty(
         Summary = "Specifies the Transformer to transform the source connection point into the destination.",
         Title = "Web Part Transformer",
         Example = @"<object id=""WebPartTransformer1"" 
                             type=""Microsoft.SharePoint.WebPartPages.TransformableFilterValuesToParametersTransformer"" lazy-init=""true""/>",
         SerializedExample = "$(PropertyThatCanResolveToTransformer)",
         InputHint = InputHint.TextArea,
         Required = false)]
        public WebPartTransformer WebPartTransformer
        {
            get
            {
                return webPartTransformer;
            }
            set
            {
                webPartTransformer = value;
            }
        }
    }
}